#include "UI_Helpers.h"


int AsciiToUtf8(LPCSTR pASCIIBuf,LPSTR pUtf8Buf /* = NULL */)
{
    {
        if (NULL == pASCIIBuf)
            return 0;
        DWORD UniCodeLen = MultiByteToWideChar(CP_ACP, 0, pASCIIBuf, -1, 0, 0);

        WCHAR* wch = new WCHAR[UniCodeLen];

        MultiByteToWideChar(CP_ACP, 0, pASCIIBuf, -1, wch, UniCodeLen);
        DWORD dwUtf8Len=WideCharToMultiByte(CP_UTF8, 0, wch, UniCodeLen , NULL, NULL, NULL, NULL );
        if (NULL == pUtf8Buf)
            return dwUtf8Len;
        DWORD sizeChar = WideCharToMultiByte(CP_UTF8, 0, wch, UniCodeLen , pUtf8Buf, dwUtf8Len, NULL, NULL );
        delete []wch;

        return sizeChar;
    }

}